﻿@model IEnumerable<ArunimaErp.Domain.postyle>
@{
    ViewBag.Title = "Index";
}
@using Telerik.Web.Mvc.UI

<script src="../../Scripts/Custom/StyleDialog.js" type="text/javascript"></script>
<script src="../../Scripts/Custom/dialog.js" type="text/javascript"></script>
<script src="../../Scripts/Custom/shipmentDialog.js" type="text/javascript"></script>
<script src="../../Scripts/Custom/costsheetDialog.js" type="text/javascript"></script>

<article class="module width_full">
<header><h3>@ViewBag.Title</h3></header>
<div class="module_content">

<p>
    @Html.ActionLink("Create New Purchase Order", "Create", "", new { @class = "create" })
</p>

<div id="successmessage"></div>

@(Html.Telerik().Grid(Model)
    .Name("PoGrid")
    .DataKeys(datakeys => datakeys.Add(k => k.PoStyleId))
        .Columns(columns =>
        {
            columns.Template(c => Html.ActionLink("Copy", "Copy", new { id = c.PoStyleId }, new { @class = "copy" }) + " | " + Html.ActionLink("Edit", "Edit", new { id = c.PoStyleId }, new { @class = "edit" }) + " | " + Html.ActionLink("Delete", "Delete", new { id = c.PoStyleId }, new { @class = "delete" }) + " </br> " + Html.ActionLink("CostSheet", "CostSheet", new { id = c.PoStyleId }, new { @class = "costsheet" }) + " | " + Html.ActionLink("Shipment", "Index", "Shipment", new { id = c.PoStyleId }, new { @class = "shipment" }))
                .Title("Action").Width(200);

            columns.Bound(c => c.styleinfo.buyerinfo.BuyerName).Width(110);
            columns.Bound(c => c.styleinfo.customerinfo.CustomerName).Width(120);
            columns.Bound(c => c.styleinfo.StyleNo).Width(110);
            columns.Bound(c => c.PoNo).Width(110);
            columns.Bound(c => c.jobinfo.JobNo).Width(50).Title("Job");
            columns.Bound(c => c.AgreedCm).Width(85);
            columns.Bound(c => c.Fob).Width(50);
            columns.Bound(c => c.ExitDate).Format("{0:dd-MMM-yy}").Width(80);
            columns.Bound(c => c.OrderQuantity).Width(110)
                .Aggregate(a => a.Sum())
                .GroupFooterTemplate(result => "Total : " + result.Sum)
                .FooterTemplate(result => "Grand Total : " + result.Sum);
        })
    .ColumnContextMenu()
    .Groupable()
    .Filterable()
    .Pageable(x=>x.PageSize(20))
    .Sortable()
    .Scrollable(x=>x.Height(400))
    .Resizable(x => x.Columns(true))
    .Reorderable(x => x.Columns(true))
  )
  
</div>
</article>
<div id="DialogDiv" title="Purchase Order">
</div>
<div id="StyleDialogDiv" title="Style">
</div>
<div id="shipmnetDialogDiv" title="Shipment">
</div>
<div id="costsheetDialogDiv" title="Cost Sheet">
</div>
